<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.List"%>
<%@page import="dto.OfertaDTO"%>
<%@page import="java.util.ListIterator"%>

<html>
<head>

  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title> Administrador de casa central </title>
  <LINK REL=StyleSheet HREF="/home/styles/style.css" TYPE="text/css" MEDIA=screen>
   <LINK REL=StyleSheet HREF="/home/styles/jquery-ui-1.8.13.custom.css" TYPE="text/css" MEDIA=screen>
  <script type="text/javascript" src="/home/javascripts/jQuery.js"></script>
  <script type="text/javascript" src="/home/javascripts/jquery-ui-1.8.13.custom.min.js"></script>
  <script type="text/javascript" src="/home/javascripts/application.js"></script>
</head>
<body>
	<div class="wrapped">
	<div class="menuDiv">
		
	<jsp:include page="menu.jsp"></jsp:include>
	
		<br />
	</div>
	<div class="content">
	
	<!-- Contenido de la página -->
	<h1> Listado de OFAD Generadas </h1>
	<%String mensaje = (String)request.getAttribute("mensaje"); %>
	<em class="error-messages"><%=mensaje==null? "" : mensaje%></em>
	<div class="contenedor">
		<div class="table-container">
		<br/>
		<br/>
		<br/>
		<table id="listado-ofads" class="admin-table" >
			<tr>
				<th> Ref </th>
				<th> Fecha </th>
				<th> XML </th>
			</tr>
			<%List<OfertaDTO> ofads = (List<OfertaDTO>)request.getAttribute("ofads"); %>
			
			<%	if(ofads!=null && !ofads.isEmpty()){ %>
			<%
					for(OfertaDTO ofad : ofads){
			%>
			<tr>
				<td> <%=ofad.getRef()%> </td>
				<td> <%=(java.util.Date)ofad.getFecha()%></td>
				<td>
				<%if(ofad.getPath() == null){%>
					<a href="/home/ofad/xml?ref=<%=ofad.getRef()%>">
						<input type="button" value="Generar XML"/>
					</a>
				<%}else{%>
					<%=ofad.getPath()%>
				<%}%>
				</td>
				<td>
					<a href="#">
						<!--<input type="button" value="Mostrar Articulos" id="<%//ofad.getRef()%>" class="mostrar-articulos" /> -->
					</a>
				</td>	
			</tr>
			<%} } %>

		</table>
		</div>
	</div>
	</div>
</div>
<div id="modal"></div>
</body>
</html>